package rjcs;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

// 三角形
/*测试样例：
0 0 0
1 2 3
2 3 4
3 4 5
1.2 2.2 3.2
-1 2 -3
1 1 1
1 1 2
1.41 1.41 2
1 1 1.41421
3，2，3
3,3,3
5、6、7
12 5 13
8 9，10
6、8、10
不想写测试用例了，谁有空补充一下
 */
public class TriangleTest {
    private static final Scanner scanner = new Scanner(System.in);
    private static final String TRIANGLE_REGEX = "(\\d+(\\.\\d+)?)[ ,，、](\\d+(\\.\\d+)?)[ ,，、](\\d+(\\.\\d+)?)";

    public static void main() {
        while (true) {
            String line = scanner.nextLine().strip();
            System.out.println("输入的数据是：" + line);
            try {
                System.out.println(parseTriangle(line));
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }
        }
    }

    private static String parseTriangle(String line) throws Exception {
        Pattern pattern = Pattern.compile(TRIANGLE_REGEX);
        Matcher matcher = pattern.matcher(line);
        if (matcher.find()) {
            double a = Double.parseDouble(matcher.group(1));
            double b = Double.parseDouble(matcher.group(3));
            double c = Double.parseDouble(matcher.group(5));
            if (a <= 0 || b <= 0 || c <= 0)
                throw new Exception("边长必须为正数");
            return judgeTriangle(a, b, c);
        } else
            throw new Exception("输入的数据格式不正确");
    }

    private static String judgeTriangle(double a, double b, double c) {
        double[] sides = {a, b, c};
        java.util.Arrays.sort(sides);
        double minSide = sides[0];
        double midSide = sides[1];
        double maxSide = sides[2];
        StringBuilder result = new StringBuilder();
        if (minSide + midSide <= maxSide)
            result.append("不是");
        else {
            if (minSide == midSide && midSide == maxSide)
                result.append("等边");
            else if (minSide == midSide || midSide == maxSide || minSide == maxSide)
                result.append("等腰");
            if (Math.abs(minSide * minSide + midSide * midSide - maxSide * maxSide) < 0.0001)
                result.append("直角");
            if (result.isEmpty())
                result.append("普通");

        }
        result.append("三角形");
        return result.toString();
    }
}
